﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Ecobee.Net
{
	/// <summary>
	/// The Location describes the physical location and coordinates of the thermostat as entered by the thermostat 
	/// owner. The address information is used in a geocode look up to obtain the thermostat coordinates. The 
	/// coordinates are used to obtain accurate weather information.
	/// </summary>
	public class Location : ApiObject
	{
		private int _timeZoneOffsetMinutes = 0;
		private string _timeZone = string.Empty;
		private bool _isDaylightSaving = false;
		private string _streetAddress = string.Empty;
		private string _city = string.Empty;
		private string _provinceState = string.Empty;
		private string _country = string.Empty;
		private string _postalCode = string.Empty;
		private string _phoneNumber = string.Empty;
		private GeoCode _mapCoordinates = GeoCode.Empty;

		/// <summary>
		/// The timezone offset in minutes from UTC. 
		/// </summary>
		[JsonProperty(PropertyName = "timeZoneOffsetMinutes")]
		public int TimeZoneOffsetMinutes
		{
			get
			{
				return _timeZoneOffsetMinutes;
			}
			set
			{
				_timeZoneOffsetMinutes= value;
			}
		}

		/// <summary>
		/// The Olson timezone the thermostat resides in (e.g America/Toronto). 
		/// </summary>
		[JsonProperty(PropertyName = "timeZone")]
		public string TimeZone
		{
			get
			{
				return _timeZone;
			}
			set
			{
				_timeZone= value;
			}
		}

		/// <summary>
		/// Whether the thermostat should factor in daylight savings when displaying the date and time. 
		/// </summary>
		[JsonProperty(PropertyName = "isDaylightSaving")]
		public bool IsDaylightSaving
		{
			get
			{
				return _isDaylightSaving;
			}
			set
			{
				_isDaylightSaving= value;
			}
		}

		/// <summary>
		/// The thermostat location street address. 
		/// </summary>
		[JsonProperty(PropertyName = "streetAddress")]
		public string StreetAddress
		{
			get
			{
				return _streetAddress;
			}
			set
			{
				_streetAddress= value;
			}
		}

		/// <summary>
		/// The thermostat location city. 
		/// </summary>
		[JsonProperty(PropertyName = "city")]
		public string City
		{
			get
			{
				return _city;
			}
			set
			{
				_city= value;
			}
		}

		/// <summary>
		/// The thermostat location State or Province. 
		/// </summary>
		[JsonProperty(PropertyName = "provinceState")]
		public string ProvinceState
		{
			get
			{
				return _provinceState;
			}
			set
			{
				_provinceState= value;
			}
		}

		/// <summary>
		/// The thermostat location country. 
		/// </summary>
		[JsonProperty(PropertyName = "country")]
		public string Country
		{
			get
			{
				return _country;
			}
			set
			{
				_country= value;
			}
		}

		/// <summary>
		/// The thermostat location ZIP or Postal code. 
		/// </summary>
		[JsonProperty(PropertyName = "postalCode")]
		public string PostalCode
		{
			get
			{
				return _postalCode;
			}
			set
			{
				_postalCode= value;
			}
		}

		/// <summary>
		/// The thermostat owner's phone number 
		/// </summary>
		[JsonProperty(PropertyName = "phoneNumber")]
		public string PhoneNumber
		{
			get
			{
				return _phoneNumber;
			}
			set
			{
				_phoneNumber= value;
			}
		}

		/// <summary>
		/// The lat/long geographic coordinates of the thermostat location. 
		/// </summary>
		[JsonProperty(PropertyName = "mapCoordinates")]
		public GeoCode MapCoordinates
		{
			get
			{
				return _mapCoordinates;
			}
			set
			{
				_mapCoordinates= value;
			}
		}
	}
}
